

package org.gps.domain;

import java.io.Serializable;
import java.util.*;

// Referenced classes of package org.gps.domain:
//			TArea

public class AlarmCacheData
	implements Serializable
{

	private static final long serialVersionUID = 1L;
	private static AlarmCacheData m_instance = null;
	private Map gpsArea;
	private Map gpsAreaList;
	private List gpsAllAreaList; //所有责任区

	public AlarmCacheData()
	{
		gpsArea = Collections.synchronizedMap(new HashMap());
		gpsAreaList = Collections.synchronizedMap(new HashMap());
		gpsAllAreaList = Collections.synchronizedList(new ArrayList<>());
	}

	public static synchronized AlarmCacheData getInstance()
	{
		if (m_instance == null)
			m_instance = new AlarmCacheData();
		return m_instance;
	}

	public List getGpsAllAreaList() {
		return gpsAllAreaList;
	}

	public void setGpsAllAreaList(List gpsAllAreaList) {
		this.gpsAllAreaList = gpsAllAreaList;
	}

	public Map getGpsAreaList()
	{
		return gpsAreaList;
	}

	public void setGpsAreaList(Map gpsAreaList)
	{
		this.gpsAreaList = gpsAreaList;
	}

	public synchronized HashMap getHrArea(Long diviceId)
	{
		return (HashMap)gpsArea.get(diviceId);
	}

	public Map getGpsArea()
	{
		return gpsArea;
	}

	public void setGpsArea(Map gpsArea)
	{
		this.gpsArea = gpsArea;
	}

	public synchronized Map getAllHrArea()
	{
		return gpsArea;
	}

	public synchronized void addHrArea(TArea area)
	{
		if (area == null)
			return;
		HashMap areaMap = (HashMap)gpsArea.get(area.getDeviceId());
		if (areaMap == null)
		{
			areaMap = new HashMap();
			gpsArea.put(area.getDeviceId(), areaMap);
		}
		areaMap.put(area.getDeviceId(), area);
	}

	public synchronized void addHrAreaList(List areaList)
	{
		TArea area;
		for (Iterator iterator = areaList.iterator(); iterator.hasNext(); addHrArea(area))
			area = (TArea)iterator.next();

	}

}
